const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
    title: 'Elin 的空间',
    tagline: '知识库建设中...',
    url: 'https://elinpf.github.io',
    baseUrl: '/',
    onBrokenLinks: 'throw',
    onBrokenMarkdownLinks: 'warn',
    favicon: 'img/favicon.ico',
    organizationName: 'Elinpf', // Usually your GitHub org/user name.
    projectName: 'elinpf.github.io', // Usually your repo name.
    plugins: [
        [
            '@docusaurus/plugin-content-docs',
            { // 规范
                id: 'spec',
                path: 'spec',
                routeBasePath: 'spec',
                editUrl: 'https://github.com/Elinpf/Elinpf.github.io/edit/master',
                sidebarPath: require.resolve('./sidebarsSpec.js'),
            },
        ],
        [
            '@docusaurus/plugin-content-docs',
            { // 网络
                id: 'network',
                path: 'network',
                routeBasePath: 'network',
                editUrl: 'https://github.com/Elinpf/Elinpf.github.io/edit/master',
                sidebarPath: require.resolve('./sidebarsNetwork.js'),
            },
        ],
        [
            require.resolve('@cmfcmf/docusaurus-search-local'),
            {
                indexDocs: true,
                indexBlog: true,
                docsRouteBasePath: '/network',
                language: ['en', 'zh'],
            }
        ]
    ],
    themeConfig: {
        navbar: {
            title: 'Elin 的空间',
            logo: {
                alt: 'My Site Logo',
                src: 'img/logo.svg',
            },
            items: [
                // {
                //     type: 'doc',
                //     docId: 'intro',
                //     position: 'left',
                //     label: 'Tutorial',
                // },
                { to: '/blog', label: 'Blog', position: 'left' },
                {
                    to: '/network/intro',
                    activeBasePath: 'network',
                    label: '网络知识库',
                    position: 'left'
                },
                {
                    to: '/spec/introduction',
                    activeBasePath: 'spec',
                    label: '编写规范',
                    position: 'left'
                },

                // Right
                {
                    href: 'https://github.com/Elinpf/Elinpf.github.io',
                    label: 'GitHub',
                    position: 'right',
                },
            ],
        },
        footer: {
            style: 'dark',
            copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
        },
        prism: {
            theme: lightCodeTheme,
            darkTheme: darkCodeTheme,
        },
    },
    presets: [
        [
            '@docusaurus/preset-classic',
            {
                docs: {
                    sidebarPath: require.resolve('./sidebars.js'),
                    // Please change this to your repo.
                    editUrl: 'https://github.com/Elinpf/Elinpf.github.io/edit/master',
                },
                blog: {
                    showReadingTime: true,
                    // Please change this to your repo.
                    editUrl: 'https://github.com/Elinpf/Elinpf.github.io/edit/master',
                },
                theme: {
                    customCss: require.resolve('./src/css/custom.css'),
                },
            },
        ],
    ],
};